enum ChatContentType { text, audio, image, video }

enum MessageStatus { not_sent, not_view, viewed }

class ChatMessage {
  final String text;
  final ChatContentType contentType;
  final MessageStatus messageStatus;
  final bool isSender;
  final int fromUserId;

  ChatMessage({
    this.text = '',
    required this.contentType,
    required this.messageStatus,
    required this.isSender,
    required this.fromUserId
  });
}

class Message {
  String? content;
  int? fromUserId;
  int? toUserId;
  int? messageType;
  int? contentType;
  String? url;
  int? createAt;

  Message(
      {this.content,
      this.fromUserId,
      this.toUserId,
      this.messageType,
      this.contentType,
      this.url, this.createAt});

  Message.fromJson(Map<String, dynamic> json) {
    content = json['content'];
    fromUserId = json['fromUserId'];
    toUserId = json['toUserId'];
    messageType = json['messageType'];
    contentType = json['contentType'];
    url = json['url'];
    createAt = json['createAt'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['content'] = this.content;
    data['fromUserId'] = this.fromUserId;
    data['toUserId'] = this.toUserId;
    data['messageType'] = this.messageType;
    data['contentType'] = this.contentType;
    data['url'] = this.url;
    data['createAt'] = this.createAt;
    return data;
  }
}
